import {ProColumns, ProForm, ProFormText, ProFormTextArea, ProFormUploadButton} from '@ant-design/pro-components';
import '@umijs/max';
import {Modal} from 'antd';
import React from 'react';

export type Props = {
  columns: ProColumns<API.InterfaceInfoVO>[];
  onCancel: () => void;
  onSubmit: (values: API.InterfaceInfoVO) => Promise<void>;
  visible: boolean;
};


const CreateModal: React.FC<Props> = (props) => {
  const {visible, onCancel, onSubmit} = props;
  // 添加上传的列


  return (
    <Modal visible={visible} footer={null} onCancel={() => onCancel?.()}>

      <ProForm<{
        name: string;
      }>
        layout={"vertical"}
        onFinish={async (values) => {
          onSubmit?.(
            values,
          );
        }}
        params={{}}
      >
        <ProFormText
          key="name"
          name="name"
          label="接口名称"
          placeholder="接口名称"
        />
        <ProFormTextArea
          key="description"
          name="description"
          label="接口描述"
          placeholder="接口描述"
        />
        <ProFormText
          key="url"
          name="url"
          label="接口地址"
          placeholder="接口地址"
        />
        <ProFormTextArea
          key="requestParams"
          name="requestParams"
          label="请求参数"
          placeholder={"{\"key\":\"value\"}"}
        />
        <ProFormTextArea
          key="requestHeader"
          name="requestHeader"
          label="请求头"
          placeholder={"{\"key\":\"value\"}"}
        />
        <ProFormTextArea
          key="responseHeader"
          name="responseHeader"
          label="响应头"
          placeholder={"{\"key\":\"value\""}
        />
        <ProFormText
          key="method"
          name="method"
          label="请求方式"
          placeholder="{请求方式"
        />
        <ProFormUploadButton
          name="file"
          label="上传SDK的jar包"
          max={1}
          fieldProps={{
            beforeUpload: () => {
              return false;
            },
          }}

        />
      </ProForm>
    </Modal>
  );
};
export default CreateModal;
